package com.rpoonolly.simplegame.textures;

import java.io.Serializable;

public final class TextureFileDescriptor implements Serializable {
	private static final long serialVersionUID = 1L;
	
	public final String filename;
	public final int mapWidth, mapHeight;
	
	public TextureFileDescriptor(String imgFileName) {
		this(imgFileName, 1, 1);
	}
	
	public TextureFileDescriptor(String filename, int tileMapWidth, int tileMapHeight) {
		this.filename = filename;
		this.mapWidth = tileMapWidth;
		this.mapHeight = tileMapHeight;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof TextureFileDescriptor))
			return false;
		return equals((TextureFileDescriptor) obj);
	}
	
	public boolean equals(TextureFileDescriptor other) {
		return filename.equals(other.filename) && mapWidth == other.mapWidth && mapHeight == other.mapHeight;
	}
	
	@Override
	public String toString() {
		return "texture Map file:\"" + this.filename + "\",rows:" + mapWidth + ",cols:" + mapHeight;
	}
}
